package net.frenopatico.citadels.manager.impl;

import lombok.extern.java.Log;
import net.frenopatico.citadels.manager.IPlayerManagerExtensions;
import net.frenopatico.citadels.model.Player;

import com.google.appengine.api.datastore.EntityNotFoundException;
import com.googlecode.objectify.Key;

/**
* Implementation class for any Player-specific methods that aren't already handled by ObjectifyGenericDAO<T>.
*/
@Log
public class PlayerManagerExtensionsImpl extends PlayerManagerImpl implements IPlayerManagerExtensions {
    /**
     * Delete a Player.
     *
     * @param player Player to delete.
     */
    @Override
    public final void delete( final Player player ) {
        // First do something special and specific for Player entities
        // ...

        // Now we can delete the entity from the datastore
        super.delete( player );
    }

    // Also have to override this version to control all delete() behavior
    @Override
    public final void delete( final Key<Player> entityKey ) {
        try {
            final Player player = this.get( entityKey );
            delete( player );
        } catch( EntityNotFoundException e ) {
            log.finest( "Entity not found." );
        }
    }

    /**
     * {@inheritDoc}
     */
    public void addCommentToPlayer( final Player essay, final String comment ) {
        // Implement the business logic specific to this unique method
        // ...
    }
}
